<?php #//AJAX PHP PENNY AUCTION v.2.0


#///////////////////////////////////////////////////////////
#//  COPYRIGHT 2009 Aaron Helmlinger ALL RIGHTS RESERVED  //
#///////////////////////////////////////////////////////////
                        include "../includes/config.inc.php";
      include "loggedin.inc.php";
         
$id = $_GET['id'];

$query = "SELECT * FROM PHPAUCTIONXL_payments WHERE userid=$id AND itemtype='BuyNow-Item-ID'"; 

$result = mysql_query($query) or die(mysql_error());
         
          $query1 = "SELECT SUM(amount),AVG(amount) FROM PHPAUCTIONXL_payments WHERE userid=$id AND itemtype='BuyNow-Item-ID'"; 

$result1 = mysql_query($query1) or die(mysql_error());

                        $query_settings = "select * from PHPAUCTIONXL_users where id='$id'";
                             $query_settings2 =  mysql_query ($query_settings);
                                $usersnick = mysql_result($query_settings2,0,"nick");

      ?>
        <HTML>
<HEAD>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
<SCRIPT Language=Javascript>
function window_open(pagina,titulo,ancho,largo,x,y){
        var Ventana= 'toolbar=0,location=0,directories=0,scrollbars=1,screenX='+x+',screenY='+y+',status=0,menubar=0,resizable=0,width='+ancho+',height='+largo;
        open(pagina,titulo,Ventana);
}
</SCRIPT>

</HEAD>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
        <tr> 
          <td class="icono"><img src="images/stats_icon2.gif" width="34" height="26" ></td>
          <td class="breadcrumbs">
         <p> <span><?=$MSG_AJAX_ADMIN_HEADING_REPORTS?></span>&nbsp;&gt;&gt;&nbsp;<?=$MSG_5142?></p></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
    <tr> 
    <td align="center" valign="middle">
<TABLE BORDER=0 WIDTH=95% CELLPADDING=0 CELLSPACING=0 BGCOLOR="#FFFFFF">
<TR>
<TD>
<CENTER>
    <BR>
    <FORM NAME=conf ACTION=<?=basename($_SERVER['PHP_SELF'])?> METHOD=POST>
        <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" class="base" style="border:1px solid #ccc;">
            <TR>
                <TD class="title">
                  <p>  <? print $MSG_AJAX_ADMIN_REPORTS_BUYNOW_PAYMENTS; ?> for <? print $usersnick; ?></p>
                    </TD>
            </TR>
            <TR>
                <TD>
    <TABLE WIDTH=100% ALIGN="CENTER" CELLPADDING=0 cellspacing="0" BGCOLOR="#FFFFFF">
      <?
      if(isset($ERR))
      {
      ?>
      <TR>
        <TD COLSPAN="2" class="error"><p>
          <? print $ERR; ?>
          </p></TD>
      </TR>
      <?
      }
                     ?>
      <TR VALIGN="TOP">
           
 
<TD WIDTH="125"> 
					<p class="blue"></p>
					</TD>
					
					
				<TD WIDTH="405">
					
      
    <font color=red>Attention: Click the type of payment you want to see below.</font><BR>
     <BR>
     <a href=userpaymenthistoryauctions.php?id=<? print $id;?>>[ Auctions ]</A>  
     <a href=userpaymenthistorybidpacks.php?id=<? print $id;?>>[ Bid Packs ]</A>  
       <a href=userpaymenthistorybuynow.php?id=<? print $id;?>>[ Buy Now ]</A><BR><BR> 
         <h1>User's Buy Now Payments </h1>
<? 

      print " PaymentID# - Payment Date / Time - Paymemt Amount - Auction ID - Auction Title<BR>";
while($row = mysql_fetch_array($result)){
     $counter++;
              
                  $bidid=$row['id'];
               $bidwhen=$row['date'];
               $bid = $row['amount'];
                $auctionid = $row['itemid'];
                  $auctiontitle = $row['itemname'];
                
          
    print "$counter) $bidid - $bidwhen - $bid - $auctionid - $auctiontitle<BR>";
     
   
    
	
	
	  
	
}    
     
              $row1 = mysql_fetch_array($result1);
              $sum = $row1['SUM(amount)'];
                    $avg = $row1['AVG(amount)'];
     
        print "<BR><BR>Total: $sum<BR><BR>Average: $avg";
     
          
    ?>      
           </TD>
			</TR>
          
    </TABLE>
    </TD>
    </TR>
    </TABLE>
    </FORM>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>





 
 
 
 
 
 


